<template>
	<view class="wrapper">
		<view class="myContent" v-for="(item, index) in listData" :key="index" @click="toDetail(item)">
			<view class="myL">
				<view class="myLbox">
					<view class="myL_title">
						<text>
							<text>{{ item.elevatorAddress || '--' }}</text>
              <template v-for="(it, i) in btnBoxList">
                <text
                    class="status tag"
                    :key="i"
                    :style="{ color: it.color, borderColor: it.color }"
                    v-if="item.emerProcType && item.emerProcType == it.key"
                >
                  {{ it.label }}
                </text>
              </template>
<!--							<text class="status tag" v-for="(it, i) in btnBoxList" :key="i" -->
<!--								v-show="it && item.emerProcType == it.key" -->
<!--								:style="{ color: it.color, borderColor: it.color, }"> -->
<!--								{{ it.label }} -->
<!--							</text> -->

							<text class="status tit_rep tag">维修</text>
						</text>
					</view>
					<view class="myR_state">
						<text :style="{ color: statusColor[item.approveStatus - 1] }">{{ statusList[item.approveStatus]
							}}</text>
						<text :style="{
							'border-right': '2rpx solid ' + statusColor[item.approveStatus - 1],
							'border-top': '2rpx solid ' + statusColor[item.approveStatus - 1],
						}"></text>
					</view>
				</view>
				<view class="myL_Time">
					{{ item.createTime || '--' }}
				</view>
				<view class="myL_reptit" v-if="item.approveStatus == 2">
					<view>维修进度:</view>
					<view class="myL_state"
						:style="{ color: statusColor2[item.status - 2], 'border': '2rpx solid ' + statusColor2[item.status - 2] }">
						{{ item.statusName || '--' }}</view>
				</view>
				<view class="myL_tit">
					<view>报障状态:</view>
					<view v-if="item.isStop">{{ item.isStop === 1 ? '正常' : item.isStop === 2 ? '停梯' : '' }}</view>
					<view v-if="item.elevatorStop">{{ item.elevatorStop === 1 ? '正常' : item.elevatorStop === 2 ? '停梯' :
						''
						}}</view>
				</view>
				<view class="myL_tit" v-if="item.problemNames">
					<view>故障现象:</view>
					<view>{{ item.problemNames.join("、") || '--' }}</view>
				</view>
				<view class="myL_tit" v-else-if="item.partsNames">
					<view>故障部件:</view>
					<view>{{ item.partsNames }}
						<text v-if="item.partsNames && item.floorStandNames">({{ item.floorStandNames.replaceAll(',','>') }})</text>	
					</view>
				</view>
				<view class="myL_tit">
					<view>报障单位:</view>
					<view>{{ item.faultCompany || item.deptName || '--' }}</view>
				</view>
				<view class="myL_tit">
					<view>报障人:</view>
					<view>{{ item.name || item.approveUser || '--' }}</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
export default {
	props: {
		listData: {
			type: Array,
			default: () => {
				return [];
			}

		},
		msg: {
			type: Object,
			default: () => {
				return {};
			}
		}
	},
	created() {
	},
	data() {
		return {
			statusList: ['全部', '待审核', '审核通过', '审核不通过', '已撤回'],
			statusColor: ['#F7B500', '#6DD400', '#FA6400', '#999999'],
			statusColor2: ['#E02020', '#0091FF', '#999999'],
			// 紧急程度标签
			btnBoxList: [
				{ color: '#0091FF', bgColor: '#dcf0ff', label: '较低', key: '4', },
				{ color: '#F7B500', bgColor: '#fff7e1', label: '普通', key: '3', },
				{ color: '#fa6400', bgColor: '#ffecdf', label: '紧急', key: '2', },
				{ color: '#e02020', bgColor: '#ffecec', label: '非常紧急', key: '1', },
			],
		};
	},
	methods: {
		toDetail(obj) {
			// eslint-disable-next-line vue/custom-event-name-casing
			this.$emit('toPage', obj);
			// uni.navigateTo({
			// 	url:"/subpages/approve/repairDetail?planId="+obj.planId+"&elevatorId="+obj.elevatorId+"&businessApproveId="+obj.businessApproveId
			// })
		}
	},
};
</script>

<style lang="scss">
.wrapper {
	// padding: 0 20rpx;

	.myContent {
		background: #ffffff;
		border-radius: 8rpx;
		display: flex;
		flex-direction: row;
		padding: 20rpx;
		margin-bottom: 20rpx;

		.myL {
			width: 100%;

			.myLbox {
				display: flex;
				justify-content: space-between;
				margin-bottom: 18rpx;
			}

			.myL_title {

				text {
					display: inline-block;
				}

				.status {
					padding: 0rpx 8rpx;
					border-radius: 8rpx;
					font-size: 26rpx !important;
					font-weight: normal !important;
					margin-left: 10rpx;
				}

				.tag {
					border: 2rpx solid transparent;
				}

				.stop {
					border: 2rpx solid #e02020;
					color: #e02020;
					margin-right: 12rpx;
				}

				.normal {
					border: 2rpx solid #0091ff;
					color: #0091ff;
					margin-right: 12rpx;
				}

				text:nth-of-type(1) {
					font-size: 28rpx;
					font-weight: bold;
					color: #333333;
					display: inline-block;

					.tit_rep {
						color: #0091FF;
						background: #DCF0FF;
					}
				}
			}

			.myL_Time {
				font-size: 24rpx;
				font-weight: 400;
				color: #999999;
				margin-bottom: 15rpx;
			}

			.myL_reptit {
				min-height: 40rpx;
				display: flex;
				flex-direction: row;
				margin-bottom: 8rpx;
				align-items: center;

				view:nth-of-type(1) {
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;
					width: 115rpx;
				}

				.myL_state {
					border: 2rpx solid #0091ff;
					border-radius: 8rpx;
					font-size: 24rpx;
					font-weight: 400;
					color: #0091ff;
					padding: 0 15rpx;
				}
			}

			.myL_tit {
				min-height: 40rpx;
				display: flex;
				flex-direction: row;

				view:nth-of-type(1) {
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;
					width: 115rpx;
				}

				view:nth-of-type(2) {
					width: calc(100% - 115rpx);
					font-size: 24rpx;
					font-weight: 400;
					color: #333333;
					// width: 320rpx;
					// overflow: hidden;
					// text-overflow: ellipsis;
					// white-space: nowrap;
				}
			}
		}

		.myR_state {
			width: 180rpx;
			text-align: right;

			text:nth-of-type(1) {
				font-size: 24rpx;
				font-weight: 400;
				color: #fa6400;
				display: inline-block;
				margin-right: 5rpx;
			}

			text:nth-of-type(2) {
				display: inline-block;
				width: 12rpx;
				height: 12rpx;
				border-right: 2rpx #fa6400 solid;
				border-top: 2rpx #fa6400 solid;
				transform: rotate(45deg);
			}
		}
	}
}
</style>
